import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

const config: Config = {
  title: 'Storm Docs',
  tagline: 'docs for storm',
  favicon: 'img/favicon.ico',

  // Set the production url of your site here
  url: 'http://192.168.16.103:30800',
  // Set the /<baseUrl>/ pathname under which your site is served
  // For GitHub pages deployment, it is often '/<projectName>/'
  baseUrl: '/',

  // GitHub pages deployment config.
  // If you aren't using GitHub pages, you don't need these.
  organizationName: 'daodao.cloud', // Usually your GitHub org/user name.
  projectName: 'storm-docs', // Usually your repo name.

  deploymentBranch: 'main',

  trailingSlash: true,

  onBrokenLinks: 'throw',
  onBrokenAnchors: 'throw',
  onBrokenMarkdownLinks: 'throw',
  onDuplicateRoutes: 'throw',

  // Even if you don't use internationalization, you can use this field to set
  // useful metadata like html lang. For example, if your site is Chinese, you
  // may want to replace "en" with "zh-Hans".
  i18n: {
    defaultLocale: 'zh-Hans',
    locales: ['zh-Hans'],
  },

  presets: [
    [
      'classic',
      {
        docs: {
          sidebarPath: './sidebars.ts',
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.
          editUrl:
            'https://gitee.com/daodao-bot/storm-docs/',
        },
        blog: {
          showReadingTime: true,
          // Please change this to your repo.
          // Remove this to remove the "edit this page" links.
          editUrl:
            'https://gitee.com/daodao-bot/storm-docs/',
        },
        theme: {
          customCss: './src/css/custom.css',
        },
      } satisfies Preset.Options,
    ],
  ],

  themeConfig: {
    // Replace with your project's social card
    image: 'img/docusaurus-social-card.jpg',
    colorMode: {
      defaultMode: 'dark',
      disableSwitch: false,
      respectPrefersColorScheme: true,
    },
    navbar: {
      title: 'Storm Docs',
      logo: {
        alt: 'Storm Docs Logo',
        src: 'img/logo.svg',
      },
      items: [
        {
          type: 'docSidebar',
          sidebarId: 'guideSidebar',
          position: 'left',
          label: '指引',
        },
        {
          to: '/blog/',
          label: '博客',
          position: 'right'
        },
        {
          to: '/about/',
          label: '关于',
          position: 'right'
        },
      ],
    },

    docs: {
      sidebar: {
        hideable: true,
        autoCollapseCategories: true,
      }
    },

    footer: {
      style: 'dark',
      links: [
        {
          title: 'Docs',
          items: [
            {
              label: '指引',
              to: '/docs/guide/',
            },
          ],
        },
        {
          title: 'Links',
          items: [
            {
              label: 'Gitee',
              href: 'https://gitee.com/daodao-bot/storm-docs/',
            },
          ],
        },
        {
          title: 'More',
          items: [
            {
              label: '博客',
              to: '/blog/',
            },
          ],
        },
      ],
      copyright: `Copyright © ${new Date().getFullYear()} daodao.cloud . Built with Docusaurus.`,
    },
    prism: {
      theme: prismThemes.github,
      darkTheme: prismThemes.dracula,
      additionalLanguages: ['java',],
    },
  } satisfies Preset.ThemeConfig,

  markdown: {
    mermaid: true,
    anchors: {
      maintainCase: true,
    },
  },

  themes: [
      '@docusaurus/theme-mermaid',
  ],

  plugins: [
      ['@easyops-cn/docusaurus-search-local', {
        hashed: true,
        language: ["en", "zh"],
      }],
  ],

};

export default config;
